<template>
  <div id="iframe-box"></div>
</template>

<script>
  export default {
    props:['html'],
    computed: {},
    data() {
      return {
         newHtml: this.html,
        refreshTimer: 0,
      }
    },
    components: {

    },
    mounted() {
        //console.log('iframe进来来。。。')
        //console.log(this.html)
        try {
          if (this.isNullOrEmpty(this.html)) {
            this.html = '暂无内容.'
          }
          this.newHtml = this.newHtml
            .replace('html><br />', 'html>')
            .replace('html><br />', 'html>')
            .replace('head><br />','head>')
            .replace('head><br />','head>')
          this.newHtml = this.newHtml.replace(/\.\.\/upload/g, process.env.IMG_URL + '/upload')
          this.refreshTimer = this.createIframe('iframe-box',this.newHtml)
        }catch (e) {}
    },
    beforeDestroy() {
      if (!this.isNullOrEmpty(this.refreshTimer)) {
        console.log('我要把iframe刷新timer清除掉了：' + this.refreshTimer)
        clearInterval(this.refreshTimer)
      }
    },
    methods: {

    }
  }
</script>

<style lang="less" scoped>

</style>
